$.extend($app, {
	//测试环境下，加载监听包
	anonymous:function(callBack){
		//测试环境加载远程监听js文件
		var urlStr = location.href;
		var xuEnd = urlStr.indexOf('\:80');
		var anonymous=urlStr.substring(0,xuEnd);
		var anonyUrl=anonymous+':8081/target/target-script-min.js#anonymous';

		document.write('<script src=\"'+anonyUrl+'\"></script>')
		callBack instanceof Function && callBack();
	},


	//获取手机硬件参数
	getInfos: function (callBack) {
		/**
		 * 需要引入linkplugins.js
		 * 该接口用于获取Link登陆后的用户信息
		 * 具体包括： loginId,password,userId,db_loginId,userName,sex,email,orgName,picture,picture_local等信息
		 */
		if($app.apiWhere){
			app.link.getLoginInfo(function(result){ //获取userLoginId
				var res=app.utils.toJSON(result);
				console.log('getLoginInfo = ',res);
				$app.userAll=JSON.stringify(res);//格式化字符串全局调用
				$app.userLoginId = res.loginId;//警察编号
			});
		}else{
			var res={
				loginId:'c888888',
				orgId:'1384773-ve1134d-334223-bt6t4a322',
				orgName:'亦强软件',
				picture_local:'images/icon4s.png',
				postDescription:'测试',
				sCode:'xbQCTI',
				telephone:'13559711764',
				type:1,
				userId:'123rever-awe-123er-ver5-berrt',
				userName:'奥特曼'
			};
			$app.userAll=JSON.stringify(res);//格式化字符串全局调用
			$app.userLoginId =res.loginId;//测试服警察编号
		}
		

		Cordova.exec(function (result) { //获取deviceId
			$app.deviceId = result;
		}, null, "ExtendApp", "getDeviceId", []);

		Cordova.exec(function (result) {//获取meid
			$app.meid = result;
		}, null, "ExtendApp", "getMeid", []);

		Cordova.exec(function (result) {//获取imsi
			$app.imsi = result;
		}, null, "ExtendApp", "getImsi", []);
		console.log('device是品高框架内自带的对象 = ',device);
		$app.app_device = {
			"deviceUuid": device.uuid,
			"deviceVersion": device.version,
			"deviceName": device.name,
			"platform": device.platform,
			"model": device.model,
			"bingoDeviceId": $app.deviceId,
			"loginId": $app.userLoginId,
			"meid": $app.meid,
			"imsi": $app.imsi
		};
		
		callBack();
	},

	//读取必要的 设备信息
	mustInfo:function(callBack){
		var j1=$app.judgeData($app.userLoginId);
		var j2=$app.judgeData($app.deviceId);
		var j3=$app.judgeData($app.meid);
		var j4=$app.judgeData($app.imsi);
		var j5=$app.judgeData($app.app_device);
		
		if(j1&&j2&&j3&&j4&&j5){
			callBack();
		}else{
			$app.getInfos(callBack);
		}
	}
});
